project(
  av_player
  LANGUAGES C CXX
)

set(CMAKE_CXX_STANDARD 17)
find_package(Qt5 COMPONENTS Widgets Core Concurrent REQUIRED)
add_definitions(-DQLS_AV_PLAYER_LIBRARY)

include(cmake/ffmpeg.cmake)

CPMAddPackage("https://gitee.com/ls56647426/SDL.git#release-2.0.22")

set(_srcs
    src/qls_av_packet_queue.cpp
    src/qls_av_player.cpp
)

set(_headers
    include/av_player/qls_av_player_global.h
    include/av_player/qls_av_packet_queue.h
    include/av_player/qls_av_player.h
)

add_library(av_player SHARED ${_srcs} ${_headers})
target_link_libraries(av_player PUBLIC
    ${FFMPEG_LIBRARYS} SDL2
    Qt5::Widgets Qt5::Core Qt5::Concurrent ${CMAKE_THREAD_LIBS_INIT}
)
target_include_directories(av_player PUBLIC include ${ffmpeg_SOURCE_DIR}/build/include)
